package cn.cmvideo.springboot.poms;

import java.util.Date;

import javax.annotation.Resource;

import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
public class Sender1002861
{
	private String queueName = "POMS_MSG1002861";
	private int count = 0;

	@Resource
	private JmsTemplate  jmsTemplate;

//	 @Scheduled(cron = "*/1 * * * * ?")
	@Scheduled(fixedRate = 1)
	public void sendMessage()
	{
		count++;
		String msg = "Sending an email message " + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH：mm：ss:SSS");
		// System.out.println(msg);
		jmsTemplate.convertAndSend(queueName, msg);
		System.out.println("发送>>>>>>>>>>>>" + count + "--" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH：mm：ss:SSS"));
	}
}
